<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <link href="../../libs/mui.min.css" rel="stylesheet"/>
    <link href="../../libs/app.css" rel="stylesheet"/>
    <link href="../../css/main.css" rel="stylesheet"/>
    <link href="../../css/assess-d.css" rel="stylesheet"/>
</head>
<body>
<div class="head">
    <img class="mui-action-back" src="../../images/all-left.png" alt="">
    <p>二押</p>
</div>
<div class="content">
    <!--列表-->
    <div class="list">
        <!--房产楼龄-->
        <div class="mui-table-view">
            <div class="mui-table-view-cell">
                <div class="lx-le">房产楼龄</div>
                <div class="lx-ri toast-one"><input class="bd-ri year" placeholder="单行输入" value="" type="number"/><span
                        class="bd-m">年</span></div>
            </div>
        </div>
        <!--房产证-->
        <div class="mui-table-view">
            <div class="mui-table-view-cell">
                <div class="lx-le">房产证</div>
                <div class="lx-ri toast-two"><input class="bd-ri month" placeholder="单行输入" value="" type="number"/><span
                        class="bd-m">月</span></div>
            </div>
        </div>

        <!--房产估值-->
        <div class="mui-table-view">
            <div class="mui-table-view-cell">
                <div class="lx-le">房产估值</div>
                <div class="lx-ri">
                    <input class="bd-ri mr2em appraisement" placeholder="单行输入" value="" type="number"/>
                    <span class="bd-m">万元</span>
                </div>
            </div>
        </div>
        <!--一押剩余-->
        <div class="mui-table-view">
            <div class="mui-table-view-cell">
                <div class="lx-le">一押剩余还款金额</div>
                <div class="lx-ri">
                    <input class="bd-ri mr2em surplus" placeholder="单行输入" value="" type="number"/>
                    <span class="bd-m">万元</span>
                </div>
            </div>
        </div>
    </div>

    <!--按钮-->
    <div class="buttons">
        <!--<div class="add add-button">继续添加</div>-->
        <div class="add add-submit" id="evaluate">提交</div>
    </div>
</div>
<script src="../../libs/mui.min.js"></script>
<script src="../../js/jquery-3.1.1.min.js"></script>
<script src="../../js/url.js"></script>
<script src="../../js/assess-public.js"></script>
<script>
    $(function () {
//        var hold = plus.webview.currentWebview().hold; todo
//        hold && $.closePages([hold]);
    });

    $('.toast-one').on('tap', function () {
        mui.toast("低于30年")
    })
    $('.toast-two').on('tap', function () {
        mui.toast("超过6个月")
    })
    //			提交
    var params = new ToArr();
    $('#evaluate').on('tap', function () {
        //各参数数组
        var month = params.rechange('.month');
        var year = params.rechange('.year');
//				var stage = params.rechange('.infoone-qx', "期");
        var price = params.rechange('.appraisement');
        var surplus = params.rechange('.surplus')

        //将各参数数组转换成符合格式的请求参数
        var arrObj = {month: month, year: year, price: price, 'over_price': surplus};// stage: stage ,

        var resParam = params.getParams(arrObj);
//				console.log(JSON.stringify(resParam));
        var nian = /^[0-9]*$/;
        var yuan = /^[0-9]+(.[0-9]{1,4})?$/;
        for (var i = 0; i < resParam.length; i++) {
            if ((!nian.test(year[i])) || year[i] == undefined || year[i] == null) {
                mui.toast('请检查您房龄...');
                return;
            } else if ((!nian.test(month[i])) || month[i] == undefined || month[i] == null) {
                mui.toast('请检查您房产证月数...');
            } else if ((!yuan.test(price[i])) || (!yuan.test(surplus[i]))) {//stage[i] == undefined || stage[i] == null || stage[i] == '选择'
                mui.toast('请检查您的金额信息...');
                return;
            } else {
                if (i === resParam.length - 1) {
                    params.getAjax("2y", resParam);
                }
            }
        }
    });
</script>
</body>

</html>